package com.qqtech.qquan.pub.model;

import java.util.Iterator;
import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.google.common.base.Splitter;
import com.google.common.collect.Lists;
import com.qqtech.core.common.util.StringUtil;
import com.qqtech.qquan.user.enums.UserConst;

@SuppressWarnings("serial")
public class PubFeedbackVo extends PubFeedback{
	/**名称**/
	private java.lang.String creatorName;
	/**头像**/
	private java.lang.String creatorImg;
	
	/** 评分平均值 */
	private Double scoreAvg;
	
	public java.lang.String getCreatorName() {
		return creatorName;
	}

	public void setCreatorName(java.lang.String creatorName) {
		this.creatorName = creatorName;
	}

	public java.lang.String getCreatorImg() {
		return creatorImg;
	}

	public void setCreatorImg(java.lang.String creatorImg) {
		this.creatorImg = creatorImg;
	}
	
	public java.lang.String getFullCreatorImg() {
		if(StringUtil.isBlank(this.getCreatorImg())){
			return "";
		}else if(this.getCreatorImg().indexOf("source://")>-1){
			return this.getCreatorImg();
		} else{
			return this.getImgHandleDomain() + getCreatorImg() + UserConst.IMG_POSTFIX;
		}
	}
	
	public List<String> getImgList() {
	    if (StringUtils.isNotBlank(this.getImg())) {
	        Iterator<String> it = Splitter.on(";").trimResults().omitEmptyStrings().split(this.getImg()).iterator();
	        return Lists.newArrayList(it);
	    }
	    return Lists.newArrayList();
	}
	
	/**是否显示图片**/
	public boolean getIsShowImg(){
		if(StringUtils.isNotBlank(this.getImg())){
			return true;
		}else{
			return false;
		}
	}

	public Double getScoreAvg() {
		return scoreAvg;
	}

	public void setScoreAvg(Double scoreAvg) {
		this.scoreAvg = scoreAvg;
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this,
				ToStringStyle.MULTI_LINE_STYLE);
	}
}